﻿#
# mingw编译说明
#

cmake_minimum_required(VERSION 3.10)

# 项目名
project(StudentManagerSystem LANGUAGES CXX)

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#生成编译信息,用于生成compile_commands.json文件，这对于使用 Clang 工具链（如 Clangd、Clang-Tidy）进行代码分析和补全非常有用
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

#添加头文件
include_directories(./source)

#查找出所有源文件
file(GLOB_RECURSE srcs
	"source/*.h"
	"source/*.ui"
	"source/*.cpp"
)

#查找所有资源文件
file(GLOB_RECURSE ress 
	"res/*.qrc"
)

add_executable(${PROJECT_NAME}
	WIN32
    ${srcs}
	${ress}
)

find_package(Qt5 COMPONENTS Core Widgets Sql Charts REQUIRED)

target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Widgets Qt5::Sql Qt5::Charts)

set_target_properties(${PROJECT_NAME} PROPERTIES 
		WIN32_EXECUTABLE OFF
	)
